#-------------------------------------------------------------------------------
# Copyright (c) 2012 Huseyin BIYIK.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the GNU Public License v3.0
# which accompanies this distribution, and is available at
# http://www.gnu.org/licenses/gpl.html
# 
# Contributors:
#     Huseyin BIYIK - initial API and implementation
#-------------------------------------------------------------------------------
import logging, binascii, time
udp_packet_size = 1024 ## max 1024 consider mss
max_header = 200
bw_seq_count = 20 ## 10 seems fine for loopback
thread_exit_timeout = 0
timeout = 3
ts_interval = 1 #hour

FORMAT = "%(levelname)s|%(asctime)s|%(module)s|%(funcName)s|%(lineno)d|%(message)s"
logging.basicConfig(format=FORMAT, level=logging.INFO)
logger = logging

def asciisize(data):
	return len(binascii.hexlify(data)) / 2

def getlastbyte(data):
	if len(data) > udp_packet_size - max_header:
		return data[udp_packet_size - max_header]
	else:
		return data

def get_ts():
	return int(time.time() * 1000 % (1000 * 60 * 60 * ts_interval))

def null_func(p1=None, p3=None, p2=None):
	return "", time.time()
